package br.unesp.demac.ccn2007.aulas5.ex01_swing;

import javax.swing.*;
import java.awt.event.*;
import java.awt.FlowLayout;

public class Exemplo1Gui extends JFrame implements ActionListener{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private JButton botao;
	private JButton botao2;

	public Exemplo1Gui(){
		botao = new JButton("botao");
		botao2 = new JButton("botao 2");
		botao.addActionListener(this);
		botao2.addActionListener(this);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		getContentPane().add(botao2);
		getContentPane().add(botao);
		setLayout(new FlowLayout());
		setSize(300,300);
		setVisible(true);
	}

	public static void main(String[] args) {
		@SuppressWarnings("unused")
		Exemplo1Gui ex = new Exemplo1Gui();
	}

	@Override
	public void actionPerformed(ActionEvent evento){
		if(evento.getSource() == botao)
			botao.setText("Fui clicado");
		else
			botao2.setText("Fui clicado tb");
	}

}
